/*
 * Copyright (c) 2008 Benoit Bouchez, Nicolas Giard
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.noocodecommit.wicket.stuff.jquery.plugin.ui.spinner;

import com.noocodecommit.wicket.stuff.jquery.plugin.JQPluginOptions;

/**
 * JQAccordion Option set
 * 
 * @author Benoit Bouchez
 * 
 */
public class JQSpinnerOptions extends JQPluginOptions implements Cloneable
{
	private String currency = "false";
	private String format = "%";
	private String items = "";
	private String group = "";
	private String point = ".";
	private boolean incremental = true;
	private int max;
	private int min;
	private int start = 0;
	private int stepping = 1;
	private int decimals = 0;

	private String initScript = "";
	private String changeScript = "";
	private String upScript = "";
	private String downScript = "";
	private String spinScript = "";

	/**
	 * Constructor
	 */
	public JQSpinnerOptions()
	{
		super();
		this.setDefaultHeader("spinner");
	}

	/**
	 * Gets the currency value
	 * 
	 * @return the currency value
	 */
	public String getCurrency()
	{
		return currency;
	}

	/**
	 * Sets the currency option value
	 * 
	 * @param currency
	 *            spinner currency
	 */
	public void setCurrency(String currency)
	{
		this.currency = currency;
		this.options.put("currency", "currency:'" + currency + "'");
	}

	/**
	 * Gets the format value
	 * 
	 * @return the format value
	 */
	public String getFormat()
	{
		return format;
	}

	/**
	 * Sets the format option value
	 * 
	 * @param format
	 *            spinner format
	 */
	public void setFormat(String format)
	{
		this.format = format;
		this.options.put("format", "format:'" + format + "'");
	}

	/**
	 * Gets the itmes value
	 * 
	 * @return the items value
	 */
	public String getItems()
	{
		return items;
	}

	/**
	 * Sets the items option value
	 * 
	 * @param items
	 *            spinner items
	 */
	public void setItems(String items)
	{
		this.items = items;
		this.options.put("items", "items:" + items);
	}

	/**
	 * Gets the group value
	 * 
	 * @return the group value
	 */
	public String getGroup()
	{
		return group;
	}

	/**
	 * Sets the group option value
	 * 
	 * @param group
	 *            spinner group
	 */
	public void setGroup(String group)
	{
		this.group = group;
		this.options.put("group", "group:'" + group + "'");
	}

	/**
	 * Gets the point value
	 * 
	 * @return the point value
	 */
	public String getPoint()
	{
		return point;
	}

	/**
	 * Sets the point option value
	 * 
	 * @param point
	 *            spinner point
	 */
	public void setPoint(String point)
	{
		this.point = point;
		this.options.put("point", "point:'" + point + "'");
	}

	/**
	 * Gets the incremental value
	 * 
	 * @return the incremental value
	 */
	public boolean isIncremental()
	{
		return incremental;
	}

	/**
	 * Sets the incremental option value
	 * 
	 * @param incremental
	 *            spinner incremental
	 */
	public void setIncremental(boolean incremental)
	{
		this.incremental = incremental;
		this.options.put("incremental", "incremental:'" + incremental + "'");
	}

	/**
	 * Gets the max value
	 * 
	 * @return the max value
	 */
	public int getMax()
	{
		return max;
	}

	/**
	 * Sets the max option value
	 * 
	 * @param max
	 *            spinner max
	 */
	public void setMax(int max)
	{
		this.max = max;
		this.options.put("max", "max:" + max);
	}

	/**
	 * Gets the min value
	 * 
	 * @return the min value
	 */
	public int getMin()
	{
		return min;
	}

	/**
	 * Sets the min option value
	 * 
	 * @param min
	 *            spinner min
	 */
	public void setMin(int min)
	{
		this.min = min;
		this.options.put("min", "min:" + min);
	}

	/**
	 * Gets the start value
	 * 
	 * @return the start value
	 */
	public int getStart()
	{
		return start;
	}

	/**
	 * Sets the start option value
	 * 
	 * @param start
	 *            spinner start
	 */
	public void setStart(int start)
	{
		this.start = start;
		this.options.put("start", "start:" + start);
	}

	/**
	 * Gets the stepping value
	 * 
	 * @return the stepping value
	 */
	public int getStepping()
	{
		return stepping;
	}

	/**
	 * Sets the stepping option value
	 * 
	 * @param stepping
	 *            spinner stepping
	 */
	public void setStepping(int stepping)
	{
		this.stepping = stepping;
		this.options.put("stepping", "stepping:" + stepping);
	}

	/**
	 * Gets the decimals value
	 * 
	 * @return the decimals value
	 */
	public int getDecimals()
	{
		return decimals;
	}

	/**
	 * Sets the decimals option value
	 * 
	 * @param decimals
	 *            spinner decimals
	 */
	public void setDecimals(int decimals)
	{
		this.decimals = decimals;
		this.options.put("decimals", "decimals:" + decimals);
	}

	/**
	 * Gets the init script value
	 * 
	 * @return the init script value
	 */
	public String getInitScript()
	{
		return initScript;
	}

	/**
	 * Sets the init function
	 * 
	 * @param initScript
	 *            spinner init function
	 */
	public void setInitScript(String initScript)
	{
		this.initScript = initScript;
		this.options.put("init", "init:function(e, ui){" + initScript + "}");
	}

	/**
	 * Gets the change script value
	 * 
	 * @return the change script value
	 */
	public String getChangeScript()
	{
		return changeScript;
	}

	/**
	 * Sets the change function
	 * 
	 * @param changeScript
	 *            spinner change function
	 */
	public void setChangeScript(String changeScript)
	{
		this.changeScript = changeScript;
		this.options.put("change", "change:function(e, ui){" + changeScript + "}");
	}

	/**
	 * Gets the up script value
	 * 
	 * @return the up script value
	 */
	public String getUpScript()
	{
		return upScript;
	}

	/**
	 * Sets the up function
	 * 
	 * @param upScript
	 *            spinner up function
	 */
	public void setUpScript(String upScript)
	{
		this.upScript = upScript;
		this.options.put("up", "up:function(e, ui){" + upScript + "}");
	}

	/**
	 * Gets the down script value
	 * 
	 * @return the down script value
	 */
	public String getDownScript()
	{
		return downScript;
	}

	/**
	 * Sets the down function
	 * 
	 * @param downScript
	 *            spinner down function
	 */
	public void setDownScript(String downScript)
	{
		this.downScript = downScript;
		this.options.put("down", "down:function(e, ui){" + downScript + "}");
	}

	/**
	 * Gets the spin script value
	 * 
	 * @return the spin script value
	 */
	public String getSpinScript()
	{
		return spinScript;
	}

	/**
	 * Sets the spin function
	 * 
	 * @param spinScript
	 *            spinner spin function
	 */
	public void setSpinScript(String spinScript)
	{
		this.spinScript = spinScript;
		this.options.put("spin", "spin:function(e, ui){" + spinScript + "}");
	}

	@Override
	protected Object clone() throws CloneNotSupportedException
	{
		JQSpinnerOptions clone = (JQSpinnerOptions) super.clone();
		return clone;
	}

}
